package com.zx.tfw.enums;

import java.util.HashMap;
import java.util.Map;

public enum PopularEnum {
	
	p1		(1, "p1"),
	p2		(2, "p2"),
	p3		(3, "p3"),
	p4		(4, "p4"),
	p5		(5, "p5"),
	p6		(6, "p6"),
	p7		(7, "p7"),
	p8		(8, "p8"),
	p9		(9, "p9"),
	p10		(10, "p10");
	
	private int code;
	
	private String name;

	private PopularEnum(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	private static Map<Integer, PopularEnum> map;
	static {
		map = new HashMap<>();
		PopularEnum[] values = PopularEnum.values();
		for (PopularEnum typeEnum : values) {
			map.put(typeEnum.getCode(), typeEnum);
		}
	}
	
	public static Map<Integer, PopularEnum> asMap(){
		return map;
	}
	
}
